package com.example.game_level;

import java.util.Random;

import org.andengine.engine.camera.Camera;
import org.andengine.entity.primitive.Rectangle;


public class Blocks{
	public Rectangle sprite;
	public static Blocks instance;
	Camera mCamera;
	Boolean movable;
	StartActivity activity;
	int cc;
	int alive=1;
	float posX,posY;
	//private int block_colors[];
	int white=0;
	
	public int color,i;
	public static Blocks getSharedInstance(){
		
		if(instance==null){
			instance = new Blocks();
		}
		return instance;
	}
	
	public Blocks(int preview){
		activity = StartActivity.getSharedInstance();
		drawpreviewblocks();
		alive=1;
	}
	

	public Blocks(){
		activity = StartActivity.getSharedInstance();
		drawblocks();
		alive=1;
	}

	public void drawpreviewblocks(){
		
		sprite=new Rectangle(0,0,112,40, StartActivity.getSharedInstance().getVertexBufferObjectManager());
		activity.color_key++;
		Random r=new Random();
		color=r.nextInt(3);
		//activity.next_color=color;
		switch(color){
		
		case 0: sprite.setColor(0, 0.46875f, 0.78125f);break;
		case 1: sprite.setColor(0.99609375f,0.2578125f,0.2578125f); break;
		case 2: sprite.setColor(0.49609375f, 0.80078125f, 0);break;
	//	case 3: sprite.setColor(0,0,0); break;
		//default: sprite.setColor(0,0,1);
		
		}
	}
	public void drawblocks(){
		
		sprite=new Rectangle(0,0,112,40, StartActivity.getSharedInstance().getVertexBufferObjectManager());
		activity.color_key++;
		Random r=new Random();
		color=r.nextInt(3);
		//activity.next_color=color;
		switch(color){
		
		case 0: sprite.setColor(0, 0.46875f, 0.78125f);break;
		case 1: sprite.setColor(0.99609375f,0.2578125f,0.2578125f); break;
		case 2: sprite.setColor(0.49609375f, 0.80078125f, 0);break;
		
		//default: sprite.setColor(0,0,1);
		
		}
		
		
		
			
		
		
		init();
	}
	
	
	public void init(){
		//sprite.registerEntityModifier(new LoopEntityModifier(new RotationModifier(5, 0, 360)));
		//sprite.registerEntityModifier(new JumpModifier(1,sprite.getX(),sprite.getX()+70,sprite.getY(),sprite.getX(),0));
		
	}
	
	public void clean() {
		sprite.clearEntityModifiers();
		sprite.clearUpdateHandlers();
	}
	
	
	
}